import axios from '@/utils/axios';

const state = {};
const mutations = {
  SET_USER_INFO: (state: any, userInfo: any) => {},
};
const actions = {
    // 创建任务
  async createTask({}, params: any) {
    const { data } = await axios({
      url: '/api/task/add',
      method: 'post',
      data: params,
    });
    return data;
  },
  // 任务中心列表
  async getTaskList() {
    const { data } = await axios({
        url: '/api/task/get',
        method: 'get',
    });
    return data;
  },
  // 我的发布列表
  async getMyTaskList() {
    const { data } = await axios({
        url: '/api/task/release/get',
        method: 'get',
    });
    return data;
  },
  // 我的领取任务列表
  async getReceiveList() {
    const { data } = await axios({
        url: '/api/task/receive/get',
        method: 'get',
    });
    return data;
  },
  // 公证员领取任务
  async userReceiveTask({}, params) {
    const { data } = await axios({
        url: '/api/task/receive',
        method: 'get',
        params
    });
    return data;
  },
  // 公证员领取任务后 放弃核实
  async userCancelTask({}, params) {
    const { data } = await axios({
        url: '/api/task/cancel',
        method: 'get',
        params
    });
    return data;
  },
  // 发布人撤销任务
  async userDelTask({}, params) {
    const { data } = await axios({
        url: '/api/task/del',
        method: 'delete',
        params
    });
    return data;
  },
  // 领取人审核任务
  async checkTask({}, params: any) {
    const { data } = await axios({
      url: '/api/task/check',
      method: 'post',
      data: params,
    });
    return data;
  },
  // 发布人评价
  async evaluateTask({}, params: any) {
    const { data } = await axios({
      url: '/api/task/evaluate',
      method: 'post',
      data: params,
    });
    return data;
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
